-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix independent_rvs determination in vectorize_over_posterior
#7890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7890 +/- ##
=======================================
Coverage 91.49% 91.49%
=======================================
Files 116 116
Lines 18962 18963 +1
=======================================
+ Hits 17349 17350 +1
Misses 1613 1613
🚀 New features to boost your workflow:
|
ricardoV94
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some small comments
dcb68e6 to
4f57c50
Compare
|
Thanks for the review @ricardoV94. I applied your comments. Sorry for the long delay |
4f57c50 to
e7e36d4
Compare
e7e36d4 to
6418107
Compare
| and not ({*outputs, *independent_rvs} & set(rv_ancestors)) | ||
| and {var for var in rv_ancestors if var in all_rvs} <= {rv, *needed_rvs} | ||
| ): | ||
| blockers = [*needed_rvs, *independent_rvs, *outputs] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: This could be a set, ancestors will convert it to one anyway.
NIT: This could be created incrementally, you're just adding independent_rvs in the loop
|
LGTM, tiny nit if you want to address. Otherwise feel free to merge |
Description
This PR fixes the determination of
independent_rvsRVs invectorize_over_posterior. I think that the fixed check is much clearer now. It says that anrvis independent if it doesn't depend on anoutput, aneeded_rv(a model freeRV that is replaced by its posterior samples), or anotherindependent_rv. To make sure the check works correctly, the candidate rv nodes are searched in the order given by their topological sort.Related Issue
vectorize_over_posteriorfails to determineindependent_rvs#7889Checklist
Type of change
📚 Documentation preview 📚: https://pymc--7890.org.readthedocs.build/en/7890/